package com.ty.day2;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : txy
 * @Create 2023/10/27 16:39
 */
public class Seven {
    public static void main(String[] args) {
        long s = 1;
        for (int i = 2; i <= 8; i++) {
            s = s * i;
        }
        System.out.println(s);
        System.out.println(func(20));
        long sum = 0;
        for (int i = 1; i <= 20; i++) {
            sum += func(i);
        }
        System.out.println(sum);

    }

    public static long func(int a) {
        if (a > 1) {
            return a * func(a - 1);
        } else {
            return 1;
        }

    }
}
